/* dongle.h
**
** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License"); 
** you may not use this file except in compliance with the License. 
** You may obtain a copy of the License at 
**
**     http://www.apache.org/licenses/LICENSE-2.0 
**
** Unless required by applicable law or agreed to in writing, software 
** distributed under the License is distributed on an "AS IS" BASIS, 
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
** See the License for the specific language governing permissions and 
** limitations under the License.
*/

/** returns 1 if line starts with prefix, 0 if it does not */

#ifndef DONGLE_H
#define DONGLE_H

#if __cplusplus
extern "C" {
#endif

struct _Dongle;
typedef struct _Dongle Dongle;

typedef enum _DongleState
{
	DONGLE_STATE_IDLE = 0,
	DONGLE_STATE_USB_ADDED,
	DONGLE_STATE_CONNECTING,
	DONGLE_STATE_CONNECTED,
	DONGLE_STATE_FAILED,
	DONGLE_STATE_DISCONNECTING,
	DONGLE_STATE_DISCONNECTED,
	DONGLE_STATE_USB_REMOVED,

	DONGLE_STATE_READY = 20
}DongleState;

// if you update this, remenber to update hardware/ril/libril/dongle.c too
typedef enum _DongleFailCause 
{
	DONGLE_FAILED_CAUSE_NONE,
	DONGLE_FAILED_CAUSE_SUCCESS,
	DONGLE_FAILED_CAUSE_USB_REMOVED,
	DONGLE_FAILED_CAUSE_SIM_UNPRESENT,
	DONGLE_FAILED_CAUSE_CONNECTING,
	DONGLE_FAILED_CAUSE_DISCONNECTING,
	DONGLE_FAILED_CAUSE_INVALID_APN,
	DONGLE_FAILED_CAUSE_ALREADY_CONNECTED,
	DONGLE_FAILED_CAUSE_UNSUPPORTED,
	DONGLE_FAILED_CAUSE_UNKNOWN
}DongleFailCause;

typedef void (*OnDongleDataStateChangedFunc)(Dongle* thiz, DongleState state, void* user_data);

Dongle* 	dongle_create(OnDongleDataStateChangedFunc onStateChanged, void* user_data);
void		dongle_destroy(Dongle* thiz);
Dongle*		dongle_get_instance(OnDongleDataStateChangedFunc onStateChanged, void* user_data);

DongleState 	dongle_get_state(Dongle* thiz);
void 			dongle_prepare_config(Dongle* thiz);
DongleFailCause dongle_get_fail_cause(Dongle* thiz);
int dongle_setup_data_connection(Dongle* thiz, const char* apn, const char* user, const char* pwd);
int	dongle_disconnect_data_connection(Dongle* thiz);
char* dongle_get_name(Dongle* thiz);
char* dongle_get_ppp_interface(Dongle* thiz);
char* dongle_get_operator_numeric(Dongle* thiz); 
#if __cplusplus
} // extern "C"
#endif


#endif


